{% extends 'base.html' %}

{% block title %}删除用户{% endblock %}

{% block page_title %}删除用户{% endblock %}

{% block breadcrumb_active %}用户管理 / 删除用户{% endblock %}

{% block content %}
<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-header">
                <h3 class="card-title">删除用户</h3>
            </div>
            <!-- /.card-header -->
            <div class="card-body">
                {% if messages %}
                    {% for message in messages %}
                        <div class="alert alert-{{ message.tags }} alert-dismissible">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                            {{ message }}
                        </div>
                    {% endfor %}
                {% else %}
                    <div class="alert alert-danger">
                        <h5><i class="icon fas fa-exclamation-triangle"></i> 警告！</h5>
                        您确定要删除用户 <strong>{{ user.username }}</strong> 吗？此操作不可撤销。
                    </div>
                    
                    <div class="card">
                        <div class="card-body">
                            <dl class="row">
                                <dt class="col-sm-3">用户名:</dt>
                                <dd class="col-sm-9">{{ user.username }}</dd>
                                
                                <dt class="col-sm-3">姓名:</dt>
                                <dd class="col-sm-9">{{ user.first_name }} {{ user.last_name }}</dd>
                                
                                <dt class="col-sm-3">电子邮箱:</dt>
                                <dd class="col-sm-9">{{ user.email }}</dd>
                                
                                <dt class="col-sm-3">活跃状态:</dt>
                                <dd class="col-sm-9">
                                    {% if user.is_active %}
                                        <span class="badge bg-success">活跃</span>
                                    {% else %}
                                        <span class="badge bg-danger">禁用</span>
                                    {% endif %}
                                </dd>
                                
                                <dt class="col-sm-3">管理员:</dt>
                                <dd class="col-sm-9">
                                    {% if user.is_staff %}
                                        <span class="badge bg-primary">是</span>
                                    {% else %}
                                        <span class="badge bg-secondary">否</span>
                                    {% endif %}
                                </dd>
                                
                                <dt class="col-sm-3">超级用户:</dt>
                                <dd class="col-sm-9">
                                    {% if user.is_superuser %}
                                        <span class="badge bg-primary">是</span>
                                    {% else %}
                                        <span class="badge bg-secondary">否</span>
                                    {% endif %}
                                </dd>
                                
                                <dt class="col-sm-3">加入日期:</dt>
                                <dd class="col-sm-9">{{ user.date_joined }}</dd>
                            </dl>
                        </div>
                    </div>
                    
                    <form method="post" class="mt-4">
                        {% csrf_token %}
                        <button type="submit" class="btn btn-danger">确认删除</button>
                        <a href="{% url 'user_list' %}" class="btn btn-default">取消</a>
                    </form>
                {% endif %}
            </div>
            <!-- /.card-body -->
        </div>
        <!-- /.card -->
    </div>
    <!-- /.col -->
</div>
<!-- /.row -->
{% endblock %}

{% block extra_js %}
<script>
    $(function() {
        // 添加表单输入样式
        $('.form-control').addClass('form-control');
        $('select').addClass('form-control');
        $('textarea').addClass('form-control');
    });
</script>
{% endblock %}